# This file has been modified to run the Rambletown Application written by Thea Ganoe, May 2008.
# The Rambletown concept, design configuration, and code is intellectual property of Thea Ganoe.

from django import newforms as forms
import models
from google.appengine.ext.db import djangoforms

class NodeForm(djangoforms.ModelForm):
  # custom form fields
  position = forms.CharField(widget=forms.TextInput(attrs={'size':'3'}))
  description = forms.CharField(widget=forms.Textarea(attrs={'rows':'3','cols':'60'}))

  class Meta:
    model = models.Node 
    exclude = ['creator', 'created', 'modified']

class RouteForm(forms.Form):
   route = forms.CharField(max_length = 100)
    
   def __init__(self, node=None, *args, **kwargs):
     self.node = node
     super(RouteForm, self).__init__(*args, **kwargs)
        
   def save(self):
     route = models.Route(node = self.node, route = self.clean_data['route'])
     route.put()

